import {
	axios
} from "./axios.js";

// 获取大家搜索的最多的关键词
export const getHotSearchKey = () => {
	return axios({
		url: '/search-history/getHotSearchKey',
		method: 'get',
	})
}

// 获取轮播图
export const getSwiperImage = () => {
	return axios({
		url: '/main-page-swiper/getSwiperImage',
		method: 'get',
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}

export const getOnlineConsultantInfoAndUserDynamic = (param) => {
	return axios({
		url: '/dynamic/getOnlineConsultantInfoAndUserDynamic',
		method: 'get',
		params: param,
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}

// 获取搜索页面的搜索历史，猜你想搜，热门话题
export const getSearchAllInfo = () => {
	return axios({
		url: '/topic/getSearchAllInfo',
		method: 'get',
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}

// 删除历史记录
export const deleteHistorySearchKeys = () => {
	return axios({
		url: '/search-history/deleteHistorySearchKeys',
		method: 'get',
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}

// 点击搜索，或者回车，搜索的keyValue都要回到后端（如果此用户搜索过，那就数量+1；如果没搜索过就要新建一条记录）
export const addSearchHistory = (data) => {
	return axios({
		url: '/search-history/addSearchHistory',
		method: 'post',
		data: data,
		headers: {
			token: uni.getStorageSync("token")
		}
	})
}